{extend name='public/layout' /}
{block name='content'}
<style>
    .left_title{ padding-bottom:5px; padding-top:5px;height:40px; font-size:24px; line-height:38px;  }
</style>
<div class="main m_t_15">
    <div class="position"><p>您当前的位置：<a href="{:url('Index/index')}" title="{$site.title}">{$site.title}</a> &gt; <a
            href="{:url('Loupan/index')}">新房</a> &gt; <a href="{:url('Loupan/detail',['id'=>$info['id']])}" title="{$info.title}">{$info.title}</a> &gt; 楼盘问答</p></div>
    <div class="m_t_15 overflow_h">
        <div class="n_h_n3_l">
            <div class="n_h_n3_t">
                {include file='loupan/nav' /}
            </div>

            <div class="news_h_box">
                <div class="left_title">{$info.title} 在线问答</div>
                <form action="{:url('Ajax/question')}" method="post" id="form">
                    <div class="ask_list_r01">
                        <p><input style="width: 680px;" type="text" placeholder="请输入标题" name="title" id="title" class="inp07"></p>
                        <p><textarea  style="width: 680px;" id="content" name="content" placeholder="请在这输入问题详细内容描述" class="inp08"></textarea></p>
                        <p class="overflow_h"><span class="adl_list_sp1">
                  <select class="select03" name="cate_id" id="cate_id">
                      <option value="0">--请选择分类--</option>
                      {volist name='ask_cate' id='val'}
                      <option value="{$val.id}" {present name="val._child"}disabled{/present}>{$val.name}</option>
                      {present name='val._child'}
                      {volist name='val._child' id='vo'}
                      <option value="{$vo.id}">--{$vo.name}</option>
                      {/volist}
                      {/present}
                      {/volist}
                  </select>
                <input type="hidden" id="house_id" name="house_id" value="{$id}">
            </span>
                            <span class="adl_list_sp2" style="float: left;margin-left: 11px;"><a class="but35"  href="javascript:;" id="askBut">提交问题</a></span></p>
                    </div>
                </form>
                <div class="m_t_15">
                    <div class="title03" style="height:41px;line-height: 41px;"><div class="more"><a href="{:url('Question/index')}">更多>></a></div>楼盘问答</div>
                    {fang:lists table='ask' where="house_id=$id and status=1" order='id desc' limit='5' page='true' id='data'}
                    <dl class="dl_p overflow_h border-bottom">
                        <dt><img src="__IMG__/loading.gif" class="lazy" data-original="{$data.user.headimgurl}" width="50" height="50" /></dt>
                        <dd class="dl01"><i class="text11">{empty name='data.user_id'}匿名用户{else /}{$data.user_name}{/empty}</i><span>{:date("Y-m-d H:i:s",$data['create_time'])}</span></dd>
                        <dd class="dl02"><a href="{:url('Question/detail',['id'=>$data['id']])}" target="_blank">{$data.content}</a></dd>
                        {php}$askid=$data['id'];{/php}
                        {fang:lists table='answer' where="ask_id=$askid and status=1" order='id desc' limit='5' empty=' ' id='vo'}
                        <dl class="dl_p overflow_h" style="padding-left:40px;">
                            <dt><img src="__IMG__/loading.gif" class="lazy" data-original="{$vo.user.headimgurl}" width="50" height="50" /></dt>
                            <dd class="dl01 answer-title" style="width:700px;"><i class="text11">{$vo.user.nickname}</i>{notempty name='vo.user.buy_phone'}<span>咨询电话：{$vo.user.buy_phone}</span>{/notempty}<span>{:date("Y-m-d H:i:s",$data['create_time'])}</span></dd>
                            <dd class="dl02 answer" style="width:700px;">{$vo.content}</dd>
                        </dl>
                        {/fang:lists}
                    </dl>
                    {/fang:lists}

                </div>
                <div class="plastic_bottom_pages m_t_15">{$pages}</div>
            </div>

        </div>
        <div class="house_r">
            <div class="title01">推荐楼盘</div>
            <div class="n_h_s_right">
                {include file='loupan/right' /}
            </div>
        </div>
    </div>



</div>
<script src="__PUBLIC__/js/plugins/jquery.ajax.form.js"></script>
<script>
    $(function(){
        $('#askBut').bind('click',function(){
            var title = $('#title').val();
            var content = $('#content').val();
            var cate_id = $('#cate_id').val();
            if(title.length==0){
                layer.msg('请填写标题',{icon:2});
                return false;
            }
            if(content.length==0){
                layer.msg('请填写内容',{icon:2});
                return false;
            }
            if(cate_id==0){
                layer.msg('请选择分类',{icon:2});
                return false;
            }
            $('#form').submit();
        });
        $('#form').ajaxForm({success:complate,dataType:'json'});
        function complate(result){
            if(result.status == 1){
                layer.msg(result.msg,{icon:1});
                setTimeout(function(){
                    window.location.href = location.href + '?t='+Math.random();
                },3000);
            } else {
                layer.msg(result.msg,{icon:2});
            }
        }
    });
</script>
{/block}